package com.ip.getip.util;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import sun.misc.Unsafe;

/**
 * @ Description   :
 * @ Author        :  leixin
 * @ CreateDate    :  2022/3/1-11:01
 * @ Version       :  1.0
 */
public class GetUnsafe {
    public static Unsafe unsafe;
    static {
        Constructor<?> constructor = Unsafe.class.getDeclaredConstructors()[0];
        constructor.setAccessible(true);
        try {
            unsafe = (Unsafe) constructor.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}
